package org.mathig.poker.action;

import org.mathig.poker.PlayerListener;
import org.mathig.poker.PlayerWrapper;
import org.mathig.poker.table.TableHand;

public class FoldAction extends PlayerAction {

	public FoldAction(PlayerWrapper player, TableHand tableHand) {
		super(player, tableHand);
	}

	public void execute() {
		logger.info("{} fold", player);
		
		tableHand.fold(player);

		// fire event
		for (PlayerListener listener : tableHand.getPlayerListeners()) {
			if (listener != player)
				listener.playerFold(player.getPlayer(), tableHand);
		}
	}

}
